#ifndef GP_MACRO
#define GP_MACRO

#ifdef TEXT
#undef TEXT
#define TEXT(s)	L##s
#endif

#define SALF_DELETE(p)			{if(p) {delete p;p = NULL;}}
#define SALF_DELETE_ARRAY(p)	{if(p) {delete[] p;p = NULL;}}

#define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000)?1:0)
#define KEYUP(vk_code)	((GetAsyncKeyState(vk_code) & 0x8000)?0:1)

#define RGB16BIT555(r,g,b) ((b & 31) + ((g & 31) << 5) + ((r & 31) << 10))
#define RGB16BIT565(r,g,b) ((b & 31) + ((g & 63) << 5) + ((r & 31) << 11))
#define RGB24BIT(r,g,b) ((b) + ((g)<<8) + ((r)<<16))
#define RGB32BIT(a,r,g,b) ((b) + ((g)<<8) + ((r)<<16) + ((a)<<24))
#define DDRAW_INIT_STRUCT(ddstruct) { memset(&ddstruct,0,sizeof(ddstruct)); ddstruct.dwSize=sizeof(ddstruct); }

#define MAX_ANGLE	360
#define MY_PI		3.1415926f / 2
#define MY_2PI		3.1415926f

#endif